/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package UI.Tree;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JMenuItem;

/**
 *
 * @author Администратор
 */
public class ContextCommandItem extends JMenuItem{

    private IContextCommand contextCommend;
    public ContextCommandItem(IContextCommand contextCommend, String name)
    {
        super(name);
        this.contextCommend = contextCommend;
        this.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                ContextCommandItemMenuKeyPressed(e);
            }
        });
    }
    protected void  ContextCommandItemMenuKeyPressed(ActionEvent e)
    {
        this.contextCommend.DoCommand(this);
    }
}
